module.exports = function(app){   

    var Activity = app.dai.regist("activity",{
        no:Number,
        title:String,
        coverurl:String,
        enddate:Date,
        max:Number,
        number:Number,
        school:String,
        clazz:String,
        content:String
    });

    var count = 0;
    var mq = Activity.find({});
    mq.sort({no:-1});
    mq.limit(1); 


    mq.find(function(err,list){
        if(list.length){
           count = list[0].no;
        }else{
            count = 0;
        }
    });

    Activity.on("add",function(data){
        data.doc.no = ++count;
    })
    
}